.order-table {
    margin-bottom: $spacer-lg;
    border: 1px solid $border-color;
    position: relative;

    .order-item-detail {
        border-top: 0 none;
    }

    .order-detail-content {
        border-top: 1px solid $border-color;
        padding: 0;
        box-shadow: none;
    }
}

.order-table-header {
    display: none;
    padding-top: $spacer-sm;
    padding-bottom: $spacer-sm;
    padding-left: $order-grid-gutter-width;
    padding-right: $order-grid-gutter-width;

    :first-child {
        position: relative;
    }

    &:last-of-type {
        border-bottom: 0;
    }
}

.order-hide-btn {
    .order-hide-btn-text {
        display: block;
    }

    .order-view-btn-text {
        display: none;
    }

    &.collapsed {
        .order-hide-btn-text {
            display: none;
        }

        .order-view-btn-text {
            display: block;
        }
    }
}

.order-wrapper {
    &:last-of-type {
        border-bottom: 0;
    }
}

.order-item-header {
    padding: $spacer-sm $order-grid-gutter-width;
}

.order-table-header-heading,
.order-table-header-order-status,
.order-table-header-context-menu {
    display: inline-block;
}

.order-table-header-order-status {
    font-weight: $font-weight-bold;
}

.order-table-header-context-menu-wrapper {
    position: absolute;
    top: $spacer-sm;
    right: $spacer-sm;
}

.order-table-header-context-menu-wrapper,
.order-table-header-heading {
    margin-top: $spacer-sm;
}

.order-table-header-order-number {
    display: block;
    font-weight: $font-weight-normal;
    margin-bottom: $spacer-lg;
    width: 100%;
    padding-left: 0;
    padding-right: 0;

    .order-table-header-label {
        display: inline;
    }
}

.order-table-header-order-table-body,
.order-table-header-order-table-header {
    padding-left: 0;
    padding-right: 0;
}

.order-table-header-order-table-body {
    border-top: 1px solid $sw-border-color;
    font-weight: $font-weight-normal;

    .order-table-header-order-table-body-cell[class*='col-'] {
        margin-top: 10px;

        &:first-of-type {
            padding-left: 0;
        }

        &:last-of-type {
            padding-right: 0;
        }
    }
}

.order-table-header-order-table-header {
    font-weight: $font-weight-bold;

    .order-table-header-order-table-header-cell[class*='col-'] {
        margin-bottom: 10px;

        &:first-of-type {
            padding-left: 0;
        }

        &:last-of-type {
            padding-right: 0;
        }
    }
}

.order-table-header-order-table {
    width: 100%;
}

.payment-control input,
.payment-control label {
    cursor: pointer;
}

.order-item {
    padding-top: $spacer-sm;
    padding-bottom: $spacer-sm;
}

.order-item-actions {
    text-align: center;
}

.order-item-label {
    float: left;
    width: 50%;
}

.order-item-value {
    width: 50%;
}

.order-table-header-context-menu-indicator {
    position: absolute;
    top: -3px;
    right: 7px;
}

.order-item-status-badge {
    /*
     * Set colors of the order status badge according to the order state.
     * The stylelint rule `selector-class-pattern` is disabled.
     * The technicalName of the order state includes underscores.
     */
    /* stylelint-disable selector-class-pattern */
    &.order-item-status-badge-open,
    &.order-item-status-badge-in_progress {
        background-color: $info;
        color: $white;
    }

    &.order-item-status-badge-completed {
        background-color: $success;
        color: $white;
    }

    &.order-item-status-badge-failed,
    &.order-item-status-badge-cancelled {
        background-color: $danger;
        color: $white;
    }
    /* stylelint-enable selector-class-pattern */

    .icon {
        color: currentColor;

        svg {
            top: 5px;
        }
    }
}

@include media-breakpoint-up(md) {
    .order-table-header {
        display: block;
    }

    .order-table-header,
    .order-item-header {
        padding-top: $spacer-sm;
        padding-bottom: $spacer-sm;
    }

    .order-item {
        padding-top: 0;
        padding-bottom: 0;
    }

    .order-item-actions {
        text-align: right;
    }
}

@include media-breakpoint-up(sm) {
    .order-table-header-order-table-body .order-table-header-label {
        @include visually-hidden();
    }
}

@include media-breakpoint-down(sm) {
    .order-table-header-order-table-header {
        display: none;
    }

    .order-table-header-order-table-body {
        border-top: 0;
    }

    .order-table-header-label {
        display: block;
        float: left;
        width: 50%;
    }

    .order-table-header-order-number {
        margin-bottom: 0;
    }

    .order-table-body-value {
        width: 50%;
    }

    .order-table-header-order-status {
        margin-top: 0;
        margin-bottom: $spacer;
    }

    .order-table-header-context-menu-wrapper {
        top: $spacer / 2;
        right: $spacer;
    }

    .order-table-header-context-menu-indicator {
        top: -3px;
        right: -3px;
    }
}
